# -*- coding: utf-8 -*-
from odoo import models, fields, api, tools, _
from odoo.exceptions import ValidationError, Warning

USER_TYPES = [
    ('main', '维保单位'),
    ('qs', '质监部门'),
    ('use', '使用单位'),
    ('service', '座席人员'),
]


class ResUsers(models.Model):
    _name = "res.users"
    _inherit = "res.users"

    user_type = fields.Selection(USER_TYPES, string="用户类型")
    use_company_id = fields.Many2one("tyibs.base.lift.use.company", string=u"使用单位")
    main_company_id = fields.Many2one("tyibs.base.maintenance.company", string=u"维保单位")
    qs_company_id = fields.Many2one("tyibs.base.qs.company", string=u"质监部门")

    qs_level = fields.Selection(related="qs_company_id.level", store=True)
